package net.sky.oa.model;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 *文档表
 *DocFile. @author hond
 */
@Entity
@Table(name = "DOC_FILE")//文档表
public class DocFile implements Serializable {

	private static final long serialVersionUID = 5673991033245515351L;
	
	// Fields
	private Long id;
	private String name;    //文档名称
	private Integer type;      //文档类别：公共文档、部门文档、个人文档
	private String annexurl;//文档地址
	private Double filesize;//文档大小
	private Date createtime;//上传时间
	private Integer issend; //文档状态
	private Integer count;  //下载次数
	private String desn;    //描述
	private Integer status;    //状态
	private DocType doctype;   //文档类型：外键关联文档类型表
	private SysEmployee user; //员工id
	private SysDept dept;   //部门id

	// Constructors

	/** default constructor */
	public DocFile() {
	}

	/** minimal constructor */
	public DocFile(Long id) {
		this.id = id;
	}
	
	@Id 
	@SequenceGenerator(name="SQ_DOCFILE_ID",sequenceName="SQ_DOCFILE_ID",allocationSize=1)
	@GeneratedValue(strategy=GenerationType.SEQUENCE,generator="SQ_DOCFILE_ID")
	@Column(name = "ID", unique = true, nullable = false)
	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	@Column(name = "NAME", length = 40)
	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}
	
	@Column(name = "TYPE", precision = 2, scale = 0)
	public Integer getType() {
		return type;
	}

	public void setType(Integer type) {
		this.type = type;
	}

	@Column(name = "ANNEXURL", length = 100)
	public String getAnnexurl() {
		return this.annexurl;
	}

	public void setAnnexurl(String annexurl) {
		this.annexurl = annexurl;
	}

	@Column(name = "FILESIZE", precision = 8)
	public Double getFilesize() {
		return this.filesize;
	}

	public void setFilesize(Double filesize) {
		this.filesize = filesize;
	}

	@Temporal(TemporalType.DATE)
	@Column(name = "CREATETIME", length = 7)
	public Date getCreatetime() {
		return this.createtime;
	}

	public void setCreatetime(Date createtime) {
		this.createtime = createtime;
	}
	
	@Column(name = "ISSEND", precision = 1, scale = 0)
	public Integer getIssend() {
		return issend;
	}

	public void setIssend(Integer issend) {
		this.issend = issend;
	}

	@Column(name = "COUNT", precision = 5, scale = 0)
	public Integer getCount() {
		return this.count;
	}

	public void setCount(Integer count) {
		this.count = count;
	}

	@Column(name = "DESN", length = 100)
	public String getDesn() {
		return this.desn;
	}

	public void setDesn(String desn) {
		this.desn = desn;
	}
	@Column(name = "STATUS", precision = 2, scale = 0)
	public Integer getStatus() {
		return status;
	}

	public void setStatus(Integer status) {
		this.status = status;
	}
	
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "TYPE_ID")
	public DocType getDoctype() {
		return doctype;
	}

	public void setDoctype(DocType doctype) {
		this.doctype = doctype;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "USER_ID")
	public SysEmployee getUser() {
		return this.user;
	}

	public void setUser(SysEmployee user) {
		this.user = user;
	}
	
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "DEPT_ID")
	public SysDept getDept() {
		return this.dept;
	}

	public void setDept(SysDept dept) {
		this.dept = dept;
	}


	
}